package com.stepforward.me;


import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import java.util.ArrayList;
import android.graphics.drawable.Drawable;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class ItemizedOverlayer extends ItemizedOverlay {
	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	public ItemizedOverlayer(Drawable defaultMarker) {
		super(boundCenterBottom(defaultMarker));
		// TODO Auto-generated constructor stub
	}
	public void addOverlay(OverlayItem overlay) {
		mOverlays.add(overlay);
		populate();
	}
	@Override
	protected OverlayItem createItem(int i) {
		return mOverlays.get(i);
	}
	@Override
	public int size() {
		return mOverlays.size();
	}


}
class MapOverlay extends com.google.android.maps.Overlay{
    @Override
    public boolean draw(Canvas canvas, MapView mapView,boolean shadow, long when) {
        super.draw(canvas, mapView, shadow);
        //---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        GeoPoint p = new GeoPoint(0,0);
        mapView.getProjection().toPixels(p, screenPts);
        //---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(null, R.drawable.androidmarker);
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);
        return true;
    }
}
